<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
  </head>
  <body>
    <div id="app">
      <!-- .self.prevent会跳转 -->
      <!-- 先阻止对自身的点击，不会阻止默认 -->
      <a href="http://baidu.com" @click.self.prevent=say1>
      <button @click=say2>点击1</button>
      </a>
      <!-- .prevent.self不会跳转 -->
      <!-- 先阻止默认，再阻止对自身的点击 -->
      <a href="http://baidu.com" @click.prevent.self=say1>
        <button @click=say2>点击2</button>
        </a>
    </div>
    <script src="./vue.js"></script>
    <script>
      const vm=new Vue({
        el:'#app',
        data:{},
        methods:{
          say1(){
            console.log(1);
          },say2(){
            console.log(2);
          }
        },
       })
    </script>
  </body>
</html>